<LayoutEditFormBox :loading="false">

    <template slot="main">
        <el-form ref="editForm" :model="form" label-width="120px" label-position="left">
            <LayoutCell>
                <LayoutCellItem title="拼团设置">
                    <el-form-item :label="form.cost_switch == 1 ? '开团成本' : '关闭开团成本'">
                        <el-radio-group v-model="form.cost_switch">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <div v-if="form.cost_switch == 1">
                        <el-form-item label="扣除" v-if="form.cost_switch == 1">
                            <el-input type="number" min="0" v-model="form.cost.award" style="width: 400px;" :min="0" v-if="JSON.stringify(form.cost) != '{}' || form.cost == null"><template
                                    slot="prepend">扣除{{ form.cost.name }}</template><template slot="append"></template></el-input>
                            <!-- <span class="w40" style="float: left;" v-if="form.cost.type == 'select'">
                                <SelectDataCoupon :appWindow="appWindow" v-model="couponsIds2"></SelectDataCoupon>
                            </span>  -->
                            <el-button @click="edit('select')" style="margin-left: 10px;">选择要扣除的资产</el-button>
                        </el-form-item>
                    </div>
                </LayoutCellItem>
                <LayoutCellItem title="抽奖设置">
                    <el-form-item label="开启抽奖">
                        <el-switch v-model="form.lottery.is_open" :active-value="1" :inactive-value="0"></el-switch>
                        <span class="text">（关闭时为正常拼团）</span>
                    </el-form-item>
                    <div v-if="form.lottery.is_open == 1">
                        <el-form-item label="中奖人数">
                            <el-input type="number" v-model="form.lottery.win_number" :min="0" style="width: 200px;"><template slot="append">人</template> </el-input>
                        </el-form-item>
                        <!-- <el-form-item label="独立规则" prop="lottery">
                            <el-switch v-model="form.lottery.is_separate_rules" :active-value="1" :inactive-value="0"></el-switch>
                        </el-form-item> -->
                        <el-form-item label="团长限制">
                            <el-radio-group v-model="form.lottery.team_leader_set">
                                <el-radio :label="0">无限制</el-radio>
                                <el-radio :label="1">必中</el-radio>
                                <el-radio :label="2">必不中</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="新会员限制">
                            <el-radio-group v-model="form.lottery.team_new_member_set">
                                <el-radio :label="0">无限制</el-radio>
                                <el-radio :label="1">必中</el-radio>
                                <el-radio :label="2">必不中</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        
                        <el-form-item label="抽中会员奖励">
                            <el-button @click="edit('yes')" style="margin-bottom: 20px;">选择抽中会员奖励</el-button>

                            <div class="member_li" v-for="item in form.lottery.winning_reward" style="display: flex;">
                                <div v-if="item.type == 'text'">
                                    <span class="member_test">{{ item.describe }}</span>
                                    <el-input-number class="w40" v-model.number="item.award" :min="0" style="width: 300px;"></el-input-number>
                                </div>
                                <div v-if="item.type == 'select'" style="display: flex;">
                                    <div class="member_test">{{ item.describe }}</div>
                                    <div class="w40" style="width: 300px;">
                                        <SelectDataCoupon :appWindow="appWindow" v-model="couponsIds" ></SelectDataCoupon>
                                    </div> 
                                </div>
                                <el-button style="margin-left: 20px;" type="text" @click="mydel(item, 'yes')">删除</el-button>
                            </div>
                        </el-form-item>
                        <el-form-item label="未抽中会员奖励">
                            <el-button @click="edit('no')" style="margin-bottom: 20px;">选择未抽中会员奖励</el-button>

                            <div class="member_li" v-for="item in form.lottery.loser_reward" style="display: flex;">
                                <div v-if="item.type == 'text'">
                                    <span class="member_test">{{ item.describe }}</span>
                                    <el-input-number class="w40" v-model.number="item.award" :min="0" style="width: 300px;"></el-input-number>
                                </div>
                                <div v-if="item.type == 'select'" style="display: flex;">
                                    <span class="member_test">{{ item.describe }}</span>
                                    <span class="w40" style="width: 300px;">
                                        <SelectDataCoupon :appWindow="appWindow" v-model="couponsIds2"></SelectDataCoupon>
                                    </span> 
                                </div>
                                <el-button style="margin-left: 20px;" type="text" @click="mydel(item, 'no')">删除</el-button>
                            </div>
                        </el-form-item>
                    </div>
                </LayoutCellItem>

            </LayoutCell>
        </el-form>
    </template>
    <template slot="footer">
        <el-button type="primary" @click="sum()">确定</el-button>
    </template>

</LayoutEditFormBox>